import request from './request.js'
import { formatGetUri } from '@/common/util.js'

const api = {}
const PORT1 = ''

// 获取用户的微信Openid
api.getOpenId = params => request.globalRequest(`/api/wxcontroller/getOpenId`, 'POST', params, 1);

// 登录,校验用户是否已注册
api.login = params => request.globalRequest(`/api/members/chat/`+params, 'GET', params, 1);

// 手机号码解密接口
api.decryptPhone = params => request.globalRequest(`/api/wxcontroller/decryptPhone`, 'POST', params, 1);

// 用户注册
api.createMember = params => request.globalRequest(`/api/members/createMember`, 'POST', params, 1);

// 商品
api.goodsSave = params => request.globalRequest(`/api/goods/save`, 'POST', params, 1);
api.goodsQuery= params => request.globalRequest(`/api/goods/getById`, 'GET', params, 1);
api.goodsDelete= params => request.globalRequest(`/api/goods/remove`, 'POST', params, 1);
api.goodsList = params => request.globalRequest(`/api/goods/list`, 'GET', params, 1);
api.goodsSearch = params => request.globalRequest(`/api/goods/search`, 'POST', params, 1);

// 商品入库
api.goodsInSave = params => request.globalRequest(`/api/goodsStoreIn/save`, 'POST', params, 1);
api.goodsInSearch = params => request.globalRequest(`/api/goodsStoreIn/search`, 'POST', params, 1);

// 商品出库
api.goodsOutSave = params => request.globalRequest(`/api/goodsStoreOut/save`, 'POST', params, 1);
api.goodsOutSearch = params => request.globalRequest(`/api/goodsStoreOut/search`, 'POST', params, 1);

// 门店下订单
api.goodsStoreSearch = params => request.globalRequest(`/api/goods/search`, 'POST', params, 1);

// 商品库存查询
api.goodsStockSearch = params => request.globalRequest(`/api/goodsStock/search`, 'POST', params, 1);

// 查询可以在门店下单的商品
api.storeStockSearch = params => request.globalRequest(`/api/goodsStoreStock/searchStoreGoods`, 'POST', params, 1);


// 订单查询
api.ordersList= params => request.globalRequest(`/api/orders/list`, 'GET', params, 1);
api.ordersSearch = params => request.globalRequest(`/api/orders/search`, 'POST', params, 1);
api.ordersRemove = params => request.globalRequest(`/api/orders/remove`, 'POST', params, 1);
api.orderGetById = params => request.globalRequest(`/api/orders/getById`, 'GET', params, 1);
api.ordersSave = params => request.globalRequest(`/api/orders/save`, 'POST', params, 1);
api.orderCount = params => request.globalRequest(`/api/orders/orderCount`, 'POST', params, 1);
// 商品出库
api.saveStoreOrder = params => request.globalRequest(`/api/orders/saveStoreOrder`, 'POST', params, 1);
// 退货
api.orderGoodRefund = params => request.globalRequest(`/api/orders/goodRefund`, 'POST', params, 1);


// 权限列表
api.employeeAuthSave = params => request.globalRequest(`/api/employeeAuth/save`, 'POST', params, 1);
api.authSearch = params => request.globalRequest(`/api/employeeAuth/search`, 'POST', params, 1);

// 员工
api.employeesSave = params => request.globalRequest(`/api/employees/save`, 'POST', params, 1);
api.employeesRemove = params => request.globalRequest(`/api/employees/remove`, 'POST', params, 1);
api.employeesGetById = params => request.globalRequest(`/api/employees/getById`, 'GET', params, 1);
api.employeesList = params => request.globalRequest(`/api/employees/search`, 'POST', params, 1);

// 门店
api.storeSave = params => request.globalRequest(`/api/stores/save`, 'POST', params, 1);
api.storeUpdate = params => request.globalRequest(`/api/stores/updateStore`, 'POST', params, 1);
api.storeRemove = params => request.globalRequest(`/api/stores/deleteStore`, 'POST', params, 1);
api.storeGetById = params => request.globalRequest(`/api/stores/`+params, 'GET', params, 1);
api.storeList = params => request.globalRequest(`/api/stores/search`, 'POST', params, 1);
api.storeSearch = params => request.globalRequest(`/api/stores/selectByCondition`, 'POST', params, 1);

// 备用金
api.pettyCashSave = params => request.globalRequest(`/api/petty-cash/save`, 'POST', params, 1);
api.pettyCashList = params => request.globalRequest(`/api/petty-cash/search`, 'POST', params, 1);

// 用户
api.userSave = params => request.globalRequest(`/api/members/updateMember`, 'POST', params, 1);
api.userGetMemberById = params => request.globalRequest(`/api/members/getMemberById/`+params, 'Get', params, 1);
api.userList = params => request.globalRequest(`/api/members/getAllMembers`, 'POST', params, 1);


// 活动
api.storeActiveSave = params => request.globalRequest(`/api/storeActive/save`, 'POST', params, 1);
api.storeActiveList = params => request.globalRequest(`/api/storeActive/queryList`, 'get', params, 1);

// 图片
api.fileUpload = params => request.globalRequest(`/api/images/upload`, 'POST', params, 1);


// 数据字典
//数据大类查询
api.dataClassAll = params => request.globalRequest(`/api/dataClass/getAllAvailable`, 'GET', params, 1);

// 数据字典
api.dataOptAdd = params => request.globalRequest(`/api/dataOpt/create`, 'POST', params, 1);
api.dataOptUpdate = params => request.globalRequest(`/api/dataOpt/update`, 'POST', params, 1);
api.dataOptDel = params => request.globalRequest(`/api/dataOpt/delete`, 'DELETE', params, 1);
api.dataOptQuery = params => request.globalRequest(`/api/dataOpt/getByClassCode/`+params, 'GET', params, 1);
api.dataOptsByCodes = params => request.globalRequest(`/api/dataOpt/getOptsByCode?`+params, 'GET', params, 1);

export default api